<?php

namespace common\models\QrcodeLog;

use Yii;

/**
 * This is the model class for table "qrcode_log".
 *
 * @property string $id
 * @property string $ip 扫码用户的IP
 * @property string $wechat_url 微信二维码的内容(即URL)
 * @property int $scan 是否已扫码，0未扫(默认)，1已扫
 * @property string $user_id 用于记录扫码登录的是哪个用户
 * @property int $type 类型：1登录，2绑定，3注册，4验证
 * @property string $wechat_open_id 微信 open id
 * @property string $wechat_user_info 微信扫码后获取的信息信息
 * @property string $updated_time 更新时间
 * @property string $extra_data 附加信息,是个JSON
 * @property int $user_type 扫码的用户类型
 * @property string $created_time
 */
class QrcodeLogBase extends \common\models\CommonModel\CommonModel
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'qrcode_log';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['scan', 'user_id', 'type', 'user_type'], 'integer'],
            [['type', 'updated_time'], 'required'],
            [['wechat_user_info', 'extra_data'], 'string'],
            [['updated_time', 'created_time'], 'safe'],
            [['ip'], 'string', 'max' => 20],
            [['wechat_url'], 'string', 'max' => 200],
            [['wechat_open_id'], 'string', 'max' => 80],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'ip' => 'Ip',
            'wechat_url' => 'Wechat Url',
            'scan' => 'Scan',
            'user_id' => 'User ID',
            'type' => 'Type',
            'wechat_open_id' => 'Wechat Open ID',
            'wechat_user_info' => 'Wechat User Info',
            'updated_time' => 'Updated Time',
            'extra_data' => 'Extra Data',
            'user_type' => 'User Type',
            'created_time' => 'Created Time',
        ];
    }
}
